package com.xyf.sys.service;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.wechat.pay.java.service.profitsharing.model.QueryOrderAmountResponse;
import com.wechat.pay.java.service.refund.model.Refund;
import com.xyf.sys.domain.Order;
import com.xyf.sys.vo.OrderVo;
import com.xyf.sys.vo.PreOrderResponseVo;

import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;

/**
 * @Author R-H
 * @Date 2024/2/241755
 * @Description
 */
public interface IWechatService {

    String getAccessToken(String appid, String secret);

    /**
     * 微信JSAPI 下单
     *
     * @param spAppid
     * @param subMchid
     * @param total
     * @param openId
     * @param outTradeNo
     * @param description
     */
    PreOrderResponseVo pay(String spAppid, String subMchid, Integer total, String openId, String outTradeNo, String description, Boolean profitSharing);

    /**
     * 申请微信退款
     *
     * @param outTradeNo【商户订单号】  原支付交易对应的商户订单号，与transaction_id二选一
     * @param outRefundNo        【商户退款单号】 商户系统内部的退款单号，商户系统内部唯一，只能是数字、大小写字母_-|*@ ，同一退款单号多次请求只退一笔。
     * @param refundAmount       【退款金额】
     * @param totalAmount【原订单金额】 原支付交易的订单总金额
     */
    Refund refund(String appid, String subMchid, String outTradeNo, String outRefundNo, BigDecimal refundAmount, BigDecimal totalAmount);

    JSONArray textOCR(String appid, String secret, String imgUrl) throws UnsupportedEncodingException;

    JSONObject idCardOCR(String appid, String secret, String imgUrl) throws UnsupportedEncodingException;

    JSONObject realName(String idcard, String name);

    JSONObject sendDeliveryOrderTemplateMessage(String appid, String secret, String template, String touser, OrderVo order);

    JSONObject sendDeliveryOrderNotifyTemplateMessage(String appid, String secret, String template, String touser, Order order, String userName, String phone);

    JSONObject sendLaundryTemplateMessage(String appid, String secret, String template, String touser, OrderVo orderVo);

    JSONObject getUserInfo(String accessToken, String openid);

    JSONObject replyFollowMessage(String message, String openid, String appid);

    void profitsharing(String subMchid, String appid, String transactionId, String outOrderNo, boolean unfreezeUnsplit);

    QueryOrderAmountResponse queryProfitSharingAmounts(String transactionId);

    JSONObject queryChannelsOrder(String orderId, String accessToken);

    String generateShortLink(String pageUrl, String pageTitle, String isPermanent, String accessToken);

    JSONArray getDeliveryList(String accessToken);

    void uploadShippingInfo(String transactionId, String trackingNo, String expressCompany, String itemDesc, String openid, String consignorContact, String receiverContact, Integer logisticsType, String accessToken);

    void notifyConfirmReceive(String transactionId, String merchantId, String merchantTradeNo, String accessToken);

    JSONObject setJumpPath(String path, String accessToken);
}
